package com.xgkj.diyiketang.task;

import com.alibaba.fastjson.JSONObject;
import com.xgkj.diyiketang.http.CouponHttpRequest;
import com.xgkj.diyiketang.http.CouponHttpResponse;
import com.xgkj.diyiketang.http.engine.CouponHttpBaseTask;
import com.xgkj.diyiketang.http.engine.TaskResultCode;

/**
 * Created by windo on 16/5/10.
 */
public class ZanzhaopianTask extends CouponHttpBaseTask{
    private String mUrl;
    private String type;
    @Override
    protected void prepareRequest() {
        super.prepareRequest();
        if (mPhase == TASK_PHASE_INIT){
            CouponHttpRequest request = new CouponHttpRequest(RequestType.ZANZHAOPIAN_REQUEST);
            JSONObject json = new JSONObject();
            json.put("photoURL",mUrl);
            json.put("type",type);
            request.setData(json.toString());
            request.setApiNo(ApiNo.ZANZHAOPIAN);
            addRequest(request);
        }
    }

    @Override
    protected void processResponseData(CouponHttpResponse response) {
            notifyTaskCompleted(TaskResultCode.SUCCESS,null);
    }

    public ZanzhaopianTask(String url,String t) {
        super(TaskType.ZANZHAOPIAN_TASK);
        mUrl = url;
        type = t;
    }
}
